import java.util.Scanner;

public class Rectangle {
    private double length;
    private double width;
    public Rectangle() {

    }
    public double getLength() {
        return length;
    }

    public void setLength(double length) {
        this.length = length;
    }

    public double getWidth() {
        return width;
    }
    public void setWidth(double width) {
        this.width = width;
    }

    public double getArea() {
        return (length*width);
    }

    public double getGirth() {
        return (2*(length+width));
    }
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("  ====计算矩形面积周长====");
        System.out.println("请输入矩形的长度:");
        double l = input.nextDouble();
        System.out.println("请输入矩形的宽度:");
        double w = input.nextDouble();
        Rectangle R = new Rectangle();
        R.setLength(l);
        R.setWidth(w);
        System.out.println("长" + String.format("%.2f",l) + ",宽" + String.format("%.2f",w) + "的矩形面积: " + String.format("%.2f",R.getArea()));
        System.out.println("长" + String.format("%.2f",l) + ",宽" + String.format("%.2f",w) + "的矩形周长: " + String.format("%.2f",R.getGirth()));
    }
}
